#include <iostream>
#include <string>
#include <memory>

class Fruit
{
    public:
        Fruit(){};
        virtual void show() = 0;
};

class Apple : public Fruit
{
    public:
        virtual void show()
        {
            std::cout << "i am apple" << std::endl;
        }
};

class Banana : public Fruit
{
    public:
        virtual void show()
        {
            std::cout << "i am banana" << std::endl; 
        }
};

class FruitFactory
{
    public:
        static std::shared_ptr<Fruit> create(const std::string& name)
        {
            if(name == "苹果")
            {
                return std::make_shared<Apple>();
            }
            else
            {
                return std::make_shared<Banana>();
            }
        }
};


int main()
{
    std::shared_ptr<Fruit> fruit = FruitFactory::create("苹果");
    fruit->show();

    fruit = w


}